package com.alibaba.nacos.config.server.jpa.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;

import org.hibernate.annotations.GenericGenerator;

/**
 * The type of nacos-all.
 *
 * @author 问道于盲
 * @date 2020-03-12
 */
@MappedSuperclass
public abstract class AbstractEntity implements Serializable,IEntity {

    private static final long serialVersionUID = 2327040301556486106L;
    @Id
    @Column(name = "ID")
    @GeneratedValue(generator = "snowflake")
    @GenericGenerator(name = "snowflake", strategy = "com.alibaba.nacos.config.server.jpa.IdGenerator")
    protected Long id;

    /**
     * get id
     *
     * @return id
     */
    public Long getId() {
        return id;
    }

    /**
     * set id
     *
     * @param id id
     */
    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public void setPK(Long id) {
        setId(id);
    }

    @Override
    public Long getPk() {
        return id;
    }
}
